package com.first.computerstore.controller;

import com.first.computerstore.entity.District;
import com.first.computerstore.service.DistrictService;
import com.first.computerstore.utils.JsonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("district")
public class DistrictController extends BaseController{
    @Resource
    private DistrictService districtService;

    /**
     * 查询省份以及城市，区域
     * @param parent
     * @return
     */
    @GetMapping("parent")
    public JsonResult<List<District>> queryParent(Integer parent){
        List<District> district = districtService.queryParent(parent);
        return new JsonResult<>(OK,district);
    }


}
